﻿using System.Data;
using Unis.Framework.Core.Infrastructure;

namespace Unis.Framework.ORM.Common
{
    internal class DbShare
    {
        // Methods
        public DbType SystemTypeNameToDbType(string typeName)
        {
            switch (typeName)
            {
                case "System.String":
                    return DbType.String;

                case "System.Boolean":
                    return DbType.Boolean;

                case "System.Int16":
                    return DbType.Int16;

                case "System.Int32":
                    return DbType.Int32;

                case "System.Int64":
                    return DbType.Int64;

                case "System.Decimal":
                    return DbType.Decimal;

                case "System.Byte[]":
                    return DbType.Binary;

                case "System.DateTime":
                    return DbType.DateTime;
            }
            return DbType.String;
        }

        // Properties
        public static DbShare Instance
        {
            get
            {
                return Singleton<DbShare>.InstanceObj;
            }
        }
    }
}
